import InfoRouter from "../router/infoRouter";
import { Menu } from 'antd';
import { AppstoreOutlined, AuditOutlined, ShoppingCartOutlined, UserOutlined, ShopOutlined, FieldTimeOutlined, ProfileOutlined } from '@ant-design/icons';
import { useHistory } from "react-router";

const { SubMenu } = Menu;

//eslint-disable-next-line
export default () => {
    const history = useHistory();

    const handleClick = ({ key }) => {
        history.push(key)
    };

    return (
        <div style={{ display: "flex", overflow: "hidden" }}>
            <Menu onClick={handleClick}
                style={{
                    width: 256,
                    minHeight: "100vh"
                }}
                defaultSelectedKeys={['1']}
                // defaultOpenKeys={['sub1','sub2','sub2-2','sub3']}
                mode="inline"
                theme="dark">
                <SubMenu key="sub1" icon={<AuditOutlined />} title="管理员管理">
                    <Menu.Item key="/info/admins">管理员列表</Menu.Item>
                    <Menu.Item key="/info/add">新增管理员</Menu.Item>
                </SubMenu>
                <SubMenu key="sub2" icon={<UserOutlined />} title="用户管理" >
                    <Menu.Item key="/info/users">用户列表</Menu.Item>
                    <SubMenu key="sub2-2" title="收货地址管理">
                        <Menu.Item key="/info/address">自提点列表</Menu.Item>
                        <Menu.Item key="/info/address_add">新增自提点</Menu.Item>
                    </SubMenu>
                </SubMenu>
                <SubMenu key="sub3" icon={<ShopOutlined />} title="商品管理">
                    <Menu.Item key="/info/comms">商品列表</Menu.Item>
                    <Menu.Item key="/info/comms/add">新增商品</Menu.Item>
                </SubMenu>
                <SubMenu key="sub4" icon={<AppstoreOutlined />} title="类型管理">
                    <Menu.Item key="/info/type">类型列表</Menu.Item>
                    <Menu.Item key="/info/type/addType">新增类型</Menu.Item>
                </SubMenu>
                <SubMenu key="sub5" icon={<ShoppingCartOutlined />} title="购物车管理">
                    <Menu.Item key="/info/carts">购物商品列表</Menu.Item>
                    <Menu.Item key="/info/carts/addshopping">新增购物商品</Menu.Item>
                </SubMenu>
                <SubMenu key="sub6" icon={<ProfileOutlined />} title="订单管理">
                    <Menu.Item key="/info/order">订单列表</Menu.Item>
                    <Menu.Item key="/info/comms">新增订单</Menu.Item>
                </SubMenu>
                <SubMenu key="sub7" icon={<FieldTimeOutlined />} title="秒杀活动">
                    <Menu.Item key="/info/seckill">秒杀商品列表</Menu.Item>
                    <Menu.Item key="/info/seckill/add">新增秒杀商品</Menu.Item>
                </SubMenu>
            </Menu>
            <InfoRouter />
        </div >)
}